package com.mf.exception;

import com.mf.Enum.ResultCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Author: lmf
 * @Create: 2024/3/23 20:55
 * Description:  自定义全局异常处理
 */

@AllArgsConstructor
@Data()
@EqualsAndHashCode(callSuper = false)
public class CustomExceptionHandler extends RuntimeException {
    private int code;
    private String message;

    public CustomExceptionHandler(ResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }
    public CustomExceptionHandler(String message) {
        this.code = 4000;
        this.message = message;
    }
}
